package com.aaa.hospital.controller;

import com.aaa.hospital.aop.Log;
import com.aaa.hospital.pojo.query.PostQuery;
import com.aaa.hospital.pojo.vo.PostVO;
import com.aaa.hospital.result.AjaxResult;
import com.aaa.hospital.service.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: danghui
 * @Date: 2022/2/21 11:32
 * @Description: TODO
 */
@RestController
@RequestMapping("post")
public class PostController {

    @Autowired
    private PostService postService;

    @RequestMapping("query")
    public AjaxResult query(PostQuery query){
        return postService.queryPost(query);
    }

    @RequestMapping("delete/{id}")
    @Log("删除职称")
    public AjaxResult delete(@PathVariable("id") Integer id){
        return postService.deletePost(id);
    }

    @Log("添加职称")
    @RequestMapping("add")
    public AjaxResult addPost(PostVO postVO){
        return postService.addPost(postVO);
    }

    @RequestMapping("get/{id}")
    public AjaxResult getPost(@PathVariable("id") Integer id){
        return postService.getPost(id);
    }

    @Log("修改职称")
    @RequestMapping("update")
    public AjaxResult update(PostVO postVO){
        return postService.updatePost(postVO);
    }
}
